#pragma once

#include <vector>
#include "Vec2.h"
#include "Game.h"
using namespace std;

class GameComponent;

class GameObject
{
	private:
		Vec2 position;						//This vector contains the x and y positions of the object
		Vec2 dimension;						//This vector contains the x and y dimensions of the object
		bool solid;							//This is true if the object is subject to collision

		vector<GameComponent*> components;	//This vector contains the components of the GameObject
		Game * parent;						//This is the pointer to the game in which this GameObject resides
	public:

		GameObject(Game* inputParent);	//This initializes the class

		Vec2 getPosition();/* Returns the position of the GameObject */
		Vec2 getDimension();/* Returns the dimension of the GameObject */
		Game * getParent();/* Returns the Game */
		GameComponent * getComponent(string compID);/* Returns a pointer to a component with the given ID. Returns NULL if no such component exists */

		void addPosition(Vec2 vec);/* Adds the vector to current position */
		void setPosition(Vec2 vec);/* Sets the position to the vector */
		void setDimension(Vec2 vec);/* Sets the dimensions to the vector */
		void addComponent(GameComponent* pComp);/*Adds the pComp (a pointer to a Component) to the GameObject*/

		bool isIntersecting(Vec2 pos, Vec2 dim);/* Returns whether or not the GameObject intersects with the given position & dimension */

		bool isSolid();					//Returns the value of "solid"
		void setSolid(bool inputSolid);

};